﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcBHXH.Common;

namespace MvcBHXH.Models
{
    class LoaiBHModel
    {
        private DataClassesBHYTTNDataContext context;
        public LoaiBHModel() 
        {
            context = Util.CreateInstance().DataContext();
        }

        public List<LoaiBHModel> GetLoaiBHModel()
        {
            var LoaiBH = from fc in context.tbl_LoaiBHs
                         select new 
                         {
                            fc.Ma_LoaiBH,
                            fc.Ten_LoaiBH,
                            fc.GhiChu,
                         };
            List<LoaiBHModel> listLoaiBHModel = new List<LoaiBHModel>();
            LoaiBHModel objLoaiBH;
            foreach (var item in LoaiBH)
            {
                objLoaiBH = new LoaiBHModel();
                objLoaiBH.MaLoaiBH = item.Ma_LoaiBH;
                objLoaiBH.TenLoaiBH = item.Ten_LoaiBH;
                listLoaiBHModel.Add(objLoaiBH);

            }
            return listLoaiBHModel;
        }


        private string maLoaiBH;

        public string MaLoaiBH
        {
            get { return maLoaiBH; }
            set { maLoaiBH = value; }
        }
        private string tenLoaiBH;

        public string TenLoaiBH
        {
            get { return tenLoaiBH; }
            set { tenLoaiBH = value; }
        }
        private string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }

    }
}
